Skip to content

FLO-22: fix maxWithdraw caps credit position#249

Open
holyfuchs wants to merge 2 commits intomainfrom
holyfuchs/FLO-22-maxWithdraw-credit-cap
Open

FLO-22: fix maxWithdraw caps credit position#249
holyfuchs wants to merge 2 commits intomainfrom
holyfuchs/FLO-22-maxWithdraw-credit-cap

Conversation

@holyfuchs
Copy link
Member

Closes: #231

maxWithdraw() capped credit-position withdrawals at trueBalance, ignoring the protocol's ability to flip the balance into debt. When a position had other collateral remaining after exhausting its credit, the view function returned the wrong (lower) figure.

Fix: When deltaTokens > trueBalance, exhaust all credit and compute the additional debt capacity against remaining collateral — matching the logic already correctly implemented in computeAvailableWithdrawal().

@holyfuchs holyfuchs requested a review from a team as a code owner March 9, 2026 12:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

FLO-22: maxWithdraw() View Function Incorrectly Caps Credit Position Withdrawals

1 participant